home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / DAEFunc.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  2KB  |  104 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_DAEFunc_h)
  24. #define octave_DAEFunc_h 1
  25.  
  26. class Matrix;
  27. class ColumnVector;
  28.  
  29. #if !defined (octave_DAEFunc_typedefs)
  30. #define octave_DAEFunc_typedefs 1
  31.  
  32. #endif
  33.  
  34. class
  35. DAEFunc
  36. {
  37. public:
  38.  
  39.   struct DAEJac
  40.     {
  41.       Matrix *dfdxdot;
  42.       Matrix *dfdx;
  43.     };
  44.  
  45.   typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x,
  46.                       const ColumnVector& xdot, double); 
  47.  
  48.   typedef DAEJac (*DAEJacFunc) (const ColumnVector& x,
  49.                 const ColumnVector& xdot, double);
  50.  
  51.   DAEFunc (void)
  52.     : fun (0), jac (0) { }
  53.  
  54.   DAEFunc (DAERHSFunc f)
  55.     : fun (f), jac (0) { }
  56.  
  57.   DAEFunc (DAERHSFunc f, DAEJacFunc j)
  58.     : fun (f), jac (j) { }
  59.  
  60.   DAEFunc (const DAEFunc& a)
  61.     : fun (a.fun), jac (a.jac) { }
  62.  
  63.   DAEFunc& operator = (const DAEFunc& a)
  64.     {
  65.       if (this != &a)
  66.     {
  67.       fun = a.fun;
  68.       jac = a.jac;
  69.     }
  70.       return *this;
  71.     }
  72.  
  73.   ~DAEFunc (void) { }
  74.  
  75.   DAERHSFunc function (void) const { return fun; }
  76.  
  77.   DAEFunc& set_function (DAERHSFunc f)
  78.     {
  79.       fun = f;
  80.       return *this;
  81.     }
  82.  
  83.   DAEJacFunc jacobian_function (void) const { return jac; }
  84.  
  85.   DAEFunc& set_jacobian_function (DAEJacFunc j)
  86.     {
  87.       jac = j;
  88.       return *this;
  89.     }
  90.  
  91. protected:
  92.  
  93.   DAERHSFunc fun;
  94.   DAEJacFunc jac;
  95. };
  96.  
  97. #endif
  98.  
  99. /*
  100. ;;; Local Variables: ***
  101. ;;; mode: C++ ***
  102. ;;; End: ***
  103. */
  104.